#include <bits/stdc++.h>

using std::min;

const int inf=0x3f3f3f3f;
const int maxn=3505;
const int maxm=2000005;

int g[maxn],G[maxn],dis[maxn];
int v[maxm],c[maxm],nxt[maxm];
int S,T;

inline void addEdge(const int &x,const int &y,const int &z){
	static int en=0;
	v[en]=y;c[en]=z;nxt[en]=g[x];g[x]=en++;
	v[en]=x;c[en]=0;nxt[en]=g[y];g[y]=en++;
	assert(en<maxm);
}

bool bfs(){
	static int q[maxn];
	int f,r;
	f=r=0;
	memset(dis,-1,sizeof dis);
	dis[S]=0;G[S]=g[S];
	for(q[r++]=S;f<r;f++){
		const int &cur=q[f];
		for(int j=g[cur];~j;j=nxt[j]){
			const int &tar=v[j];
			if(~dis[tar]) continue;
			if(!c[j]) continue;
			dis[tar]=dis[cur]+1;
			G[tar]=g[tar];
			q[r++]=tar;
		}
	}
	return ~dis[T];
}
int dfs(int p,int flow){
	if(p==T) return flow;
	int alpha=flow,fl;
	for(int &j=G[p];~j;j=nxt[j]){
		const int &tar=v[j];
		if(dis[tar]==dis[p]+1&&c[j]&&(fl=dfs(tar,min(alpha,c[j])))){
			c[j]-=fl;c[j^1]+=fl;alpha-=fl;
		}
	}
	return flow-alpha;
}

int main(){
	int n,ans,flow;

	freopen("balla.in","r",stdin);
	freopen("balla.out","w",stdout);

	scanf("%d",&n);
	S=0;T=3500;
	flow=0;
	memset(g,-1,sizeof g);
	for(ans=1;;ans++){
		//fprintf(stderr, "ans=%d\n", ans);
		addEdge(S,ans,1);
		addEdge(ans+1600,T,1);
		for(int i=1;;i++){
			int t=i*i;
			if(t<=ans) continue;
			if(t-ans>=ans) break;
			addEdge(t-ans,ans+1600,1);
		}
		while(bfs()) flow+=dfs(S,inf);
		if(ans-flow>n) break;
	}

	printf("%d\n",ans-1);
	return 0;
}
